package com.topscomm.mis.cbb.file.compare.word.handler;

import com.topscomm.mis.cbb.file.compare.cj.CjSystemConst;
import com.topscomm.mis.cbb.file.compare.cj.pojo.CjCompareJobResultEntity;
import java.util.List;

/**
 * @description:
 * @author: zhanglongfei
 * @date: 2023/2/24 8:45
 */
public class BasicCompareHandler {

    /**
     * @description: 
     
     * @return: com.topscomm.mis.cbb.file.compare.cj.pojo.CjCompareJobResultEntity 
     * @author: zhanglongfei
     * @date: 2023/2/24 8:47
     * @modify:
     */
    public CjCompareJobResultEntity createNewResultEntity() {
        CjCompareJobResultEntity model = new CjCompareJobResultEntity();
        model.setParagraphno(-1);
        model.setPageno(-1);
        model.setColumnno(-1);
        model.setTableno(-1);
        model.setRowno(-1);
        model.setRunno(-1);
        return model;
    }

    /**
     * @description:
     * @param value:
     * @return: java.lang.String 
     * @author: zhanglongfei
     * @date: 2023/2/24 8:54
     * @modify:
     */
    protected String toString(String value) {
        if (value == null) return "";
        return value;
    }

    /**
     * description 生成差异项实体
     * @author wxm
     * @date 2023-06-14 14:39:28
     * @param diffContent1
     * @param diffContent2
     * @param diffType
     * @return com.topscomm.mis.cbb.file.compare.cj.pojo.CjCompareJobResultEntity
     * @modify
     */
    protected CjCompareJobResultEntity getCjCompareJobResultEntity(List<String> diffContent1,
        List<String> diffContent2,String diffType) {
        if (diffContent1.size() > 0) {
            CjCompareJobResultEntity resultEntity = createNewResultEntity();
            resultEntity.setDoccontent1(String.join(";", diffContent1));
            resultEntity.setDoccontent2(String.join(";", diffContent2));
            resultEntity.setDifftype(diffType);
            return resultEntity;
        } else {
            return null;
        }
    }
}
